home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
visds
/
modaldlg.dsc
< prev
next >
Wrap
Text File
|
1999-05-02
|
2KB
|
62 lines
title Modal Dialog Test
REM Demonstrate creating and using a modal child dialog
DIALOG CREATE,Main Dialog,20,20,220,166,SAVEPOS Main
DIALOG ADD,LIST,LIST1,10,10,198,96
DIALOG ADD,BUTTON,Add,116,10,,,,default
DIALOG ADD,BUTTON,Close,116,144,64,24
DIALOG ADD,STATUS,SB,Click Add to add an item of text to the list
DIALOG SHOW
:Main_evloop
wait event
%E = @event()
goto %E
:AddBUTTON
goto Child_Dialog
:CloseBUTTON
:CLOSE
exit
:Child_Dialog
DIALOG CREATE,Child Dialog,20,0,284,72,SAVEPOS Child,NOMIN
DIALOG ADD,EDIT,CEDIT1,10,10
DIALOG ADD,BUTTON,OK,8,206,,,,default
DIALOG ADD,BUTTON,Cancel,38,206
DIALOG SHOWMODAL
REM When SHOWMODAL is used, only the buttons on the child
REM dialog can generate an event. This simplifies the
REM event processing compared to the non-modal example,
REM no event loop is needed or indeed possible, because
REM once any button is pressed the dialog is closed. This
REM means that all you can do is get the data from the
REM child dialog (depending on what button was pressed)
REM and then close the form.
wait event
%E = @event()
REM The modal dialog has disappeared from the screen, although
REM it still exists so you can get the data from it.
goto Child_%E
:Child_OKBUTTON
dialog select,1
%A = @dlgtext(cedit1)
dialog select,0
list add,list1,%A
dialog select,1
:Child_CancelBUTTON
:Child_CLOSE
REM This DIALOG CLOSE command closes the (now hidden)
REM dialog
DIALOG CLOSE
REM Wait for the CLOSE event that is generated...
wait event
REM ...and throw it away (otherwise it will be executed
REM by the main event loop!)
%E = @event()
goto Main_evloop